# libc Meson Build File

libc_include_directories = [
	include_directories('stdlib', is_system: true),
	include_directories('string', is_system: true),
	include_directories('x86_64', is_system: true)
]

libc = static_library('c',
	[
		'malloc_aligned.c',
		'malloc_freelist.c',
		'ctype/isalnum.c',
		'ctype/isascii.c',
		'ctype/isblank.c',
		'ctype/iscntrl.c',
		'ctype/isdigit.c',
		'ctype/isgraph.c',
		'ctype/islower.c',
		'ctype/isprint.c',
		'ctype/ispunct.c',
		'ctype/isspace.c',
		'ctype/isupper.c',
		'ctype/isxdigit.c',
		'ctype/toascii.c',
		'ctype/tolower.c',
		'ctype/toupper.c',
		'stdlib/abs.c',
		'stdlib/atof.c',
		'stdlib/atoi.c',
		'stdlib/atol.c',
		'stdlib/atoll.c',
		'stdlib/bsearch.c',
		'stdlib/calloc.c',
		'stdlib/div.c',
		'stdlib/heapsort.c',
		'stdlib/heapsort_r.c',
		'stdlib/imaxabs.c',
		'stdlib/imaxdiv.c',
		'stdlib/labs.c',
		'stdlib/ldiv.c',
		'stdlib/llabs.c',
		'stdlib/lldiv.c',
		'stdlib/qsort.c',
		'stdlib/qsort_r.c',
		'stdlib/rand.c',
		'stdlib/realloc.c',
		'stdlib/strtod.c',
		'stdlib/strtof.c',
		'stdlib/strtol.c',
		'stdlib/strtoll.c',
		'stdlib/strtoull.c',
		'string/memcmp.c',
		'string/memcpy.c',
		'string/memmem.c',
		'string/memmove.c',
		'string/memrchr.c',
		'string/memset.c',
		'string/strcat.c',
		'string/strchr.c',
		'string/strchrnul.c',
		'string/strcmp.c',
		'string/strcpy.c',
		'string/strdup.c',
		'string/strlen.c',
		'string/strncat.c',
		'string/strncmp.c',
		'string/strndup.c',
		'string/strnlen.c',
		'string/strnstr.c',
		'string/strrchr.c',
		'string/strstr.c',
		'string/strtok.c',
		'support/fls.c',
		'support/flsl.c',
		'support/flsll.c',
	],
	include_directories: libc_include_directories,
	c_args: [
		'-fno-builtin',
		'-static',
		'-nodefaultlibs'
	],
	link_args: [
		'-static',
		'-nodefaultlibs',
		'-nostartfiles',
		'-Wl,-preload',
		'-Wl,-all_load',
		'-Wl,-dead_strip',
		'-Wl,-prebind'
	],
	build_by_default: true
)

